{% extends "sentry/bases/organization.html" %}

{% load crispy_forms_tags %}
{% load i18n %}

{% block org_auth_settings_nav %}active{% endblock %}

{% block main %}
  <h3>{{ provider_name }} Authentication</h3>

  <div class="box">
    <div class="box-content with-padding">
      <form method="POST">
        {% csrf_token %}

        <h4>Login URL</h4>

        <p>While Sentry will try to be clever about directing members to the appropriate login form, you're safest just to hit up your organization-specific login when visiting the app:</p>

        <pre><a href="{{ login_url }}">{{ login_url }}</a></pre>

        {% if pending_links_count %}
          <hr>
          <h4>Unlinked Members</h4>

          <button class="btn btn-primary pull-right" name="op"
                  value="reinvite" style="margin-left: 20px">Send Reminders</button>

          <p>There are currently {{ pending_links_count }} member(s) who have not yet linked their account with {{ provider_name }}. Until this is done they will be unable to access the organization.</p>

        {% endif %}

        {% if content %}
          <hr>
          {{ content }}
        {% endif %}

        <hr>

        <h3>General Settings</h3>

        {{ form|as_crispy_errors }}

        {% for field in form %}
          {{ field|as_crispy_field }}
          {% if forloop.last %}
            <fieldset class="form-actions">
              <button class="btn btn-primary pull-right" name="op"
                value="settings" style="margin-left: 20px">Save Settings</button>
            </fieldset>
          {% endif %}
        {% endfor %}

        <hr>

        <h3>Disable {{ provider_name }} Authentication</h3>

        <button class="btn btn-danger pull-right" name="op"
                value="disable" style="margin-left: 20px">Disable {{ provider_name }} Auth</button>

        <p>Your organization will no longer being able to authenticate with their existing accounts. This will prevent any existing users from logging in unless they have access outside of SSO.</p>

      </form>
    </div>
  </div>
{% endblock %}
